package com.wanyang.service;

import com.wanyang.dos.OpenApiAuthDO;
import com.wanyang.mapper.OpenApiAuthDOMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class OpenApiAuthServiceImpl implements OpenApiAuthService {
    @Resource
    private OpenApiAuthDOMapper openApiAuthDOMapper;

    @Override
    public boolean validate(String appId, String secret) {
        OpenApiAuthDO openApiAuthDO = openApiAuthDOMapper.selectByPrimaryKey(appId);
        return openApiAuthDO != null && secret.equals(openApiAuthDO.getSecret()) && !openApiAuthDO.getIsDelete();
    }
}
